<#import "add_base.ftl" as add/>
<@add.html>
<script type="text/javascript">
  function getme(c) {
    if(c!="") {
      getJson("getEarnest?saleId="+c, function(data){
        if(data.ret) {
          var mc = data.data;
          var fm = getEl("fm_input");
          fm.contractCode.value = mc.saleId;
          fm.saleDate.value = getDateStr(new Date(mc.saleDate));
          fm.earnestType.value = mc.earnestType+" - "+mc.earnestTypeName;
          fm.memberCode.value = mc.memberCode;
          fm.memberName.value = mc.memberName;
          fm.earnestAmount.value = formatMoney(mc.earnestAmount);
        } else {
          window.alert(data.msg);
          clme();
        }
      });
    } else {
      clme();
    }
  }
  function clme() {
    var fm = getEl("fm_input");
    fm.contractCode.value = "";
    fm.saleDate.value = "";
    fm.earnestType.value = "";
    fm.memberCode.value = "";
    fm.memberName.value = "";
    fm.earnestAmount.value = "";
  }
</script>
        <tr>
          <th width="85">定金编号</th>
          <td width="160"><input type="text" name="contractCode" value="" req="定金编号" onchange="getme(this.value);" maxlength="20"></td>
          <th width="85"></th>
          <td width="160"></td>
        </tr>
        <tr>
          <th>销售日期</th>
          <td><input type="text" name="saleDate" value="" class="date disable" maxlength="10" readonly></td>
          <th>定金类型</th>
          <td><input type="text" name="earnestType" value="" class="disable" readonly></td>
        </tr>
        <tr>
          <th>会员姓名</th>
          <td><input type="text" name="memberName" value=""  class="disable" readonly></td>
          <th>会员编号</th>
          <td><input type="text" name="memberCode" value="" class="disable" readonly></td>
        </tr>
        <tr>
          <th>定金金额</th>
          <td><input type="text" name="earnestAmount" value="" class="disable" readonly></td>
          <th></th>
          <td></td>
        </tr>

</@add.html>